GRPC and Protobuffers
gRPC lets a client call operations on another application. Protocol Buffers define the service and message schema used to generate compatible Go code.
Run the Protocol Buffer compiler (protoc) with the following command:
protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
protobuffers/api.proto
Set up your .proto file as example from below
syntax = "proto3";
option go_package = "lukas8219/grpc-playground";
package playground;
service Playground {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
Share: